#ifndef __TARGETWINDOW
#define __TARGETWINDOW

#include <FL/Fl.H>
#include <FL/Fl_Window.H>
#include <FL/Fl_Round_Button.H>
#include <FL/Fl_Check_Button.H>
#include <FL/Fl_Value_Slider.H>
#include <FL/fl_draw.H>
#include <FL/Fl_Menu_Bar.H>
#include <FL/Fl_Menu_Item.H>
#include <FL/Fl_Choice.H>

#include <stdio.h>
#include <stdlib.h>
#include <math.h>

#include "GBCSolution.h"

class TargetWindow : public Fl_Window {
	public:
	TargetWindow(int, int, GBCSolution*, GBCSolution*, GBCSolution*, GBCSolution*);
	~TargetWindow(void);
	GBCSolution* gsln;
	GBCSolution* mem1;
	GBCSolution* mem2;
	GBCSolution* mem3;
	

	
	private:
	virtual void draw(void);
	int cwidth;
	int cheight;
	int x_ticks;
	int y_ticks;
	
	int xmin, ymin, xmax, ymax;
	int y0, x0;
	int t_range;
	double x_range, y_range;
	double x_scale, y_scale;
	
	void PlotImpact(int px, int py, double r1, double r2, int label);
	void PlotMem(GBCSolution* mem, int mode);
	void SetupPlot(void);
	void DrawPlotBackground(int mode, const char *ylabel);
	void DrawPlotData(int mode);
	void PlotPath(int ptype);
	
	int x_click;
	int y_click;
	
	Fl_Check_Button* btMem1;
	Fl_Check_Button* btMem2;
	Fl_Check_Button* btMem3;
	Fl_Check_Button* btPerspective;
	Fl_Check_Button* btTargetPos;
	
	Fl_Value_Slider* sl_x;
	
	Fl_Choice* cScopeGuides;
	Fl_Choice* cTargetType;
	
	Fl_Menu_Bar* menu;
	
	virtual int handle(int);
	static void cb_nothing(Fl_Widget* o, void* v);
	static void cb_Close(Fl_Widget* o, void* v);
	static void cb_btPlot(Fl_Widget* o, void* v);
	static void cb_slUpdate(Fl_Widget* o, void* v);
	static void cb_Mem1(Fl_Widget* o, void* v);
	static void cb_Mem2(Fl_Widget* o, void* v);
	static void cb_Mem3(Fl_Widget* o, void* v);
	static void cb_Guides(Fl_Widget* o, void* v);
	static void cb_TargetType(Fl_Widget* o, void* v);
	static void cb_Perspective(Fl_Widget* o, void* v);
	static void cb_TargetPos(Fl_Widget* o, void* v);
	

};

#endif
